<?php
header("Content-type: application/json");
$con = mysql_connect("localhost", "root", "");
if (!$con)
{
  die('Could not connect: ' . mysql_error());
} else {
   mysql_select_db("dutoan_db", $con);
 
   $res = mysql_query("SELECT * From thetest");
 
   $arr = array();
   while($obj = mysql_fetch_array($res)) {
      $arr[] = array(
         'id' => $obj["id"],
         'c11' => str_replace("\'", "'", $obj["c1"]),
         'c2' => str_replace("\'", "'", $obj["c2"])
      );
}
 
mysql_close($con);
 
print json_encode($arr);
}
?>     
